From 90ce18c7560973ab8459a8d2cddd9971720c48d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Oct 2013 10:52:38 -0700 Subject: [PATCH] * lisp.h (eassert): Don't use 'assume'. Sometimes 'assume' wins in performance, and sometimes it loses, so it shouldn't be used all the time. Perhaps we need two flavors of 'eassert', one for where 'assume' is far more likely to help or to hurt; but that can be done later. Problem reported by Dmitry Andipov in . Also, don't include ; no longer needed. --- src/ChangeLog | 11 +++++++++++ src/lisp.h | 9 +++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b425792486b..e6d9ce695aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2013-10-09 Paul Eggert + + * lisp.h (eassert): Don't use 'assume'. + Sometimes 'assume' wins in performance, and sometimes it loses, + so it shouldn't be used all the time. Perhaps we need two + flavors of 'eassert', one for where 'assume' is far more likely + to help or to hurt; but that can be done later. + Problem reported by Dmitry Andipov in + . + Also, don't include ; no longer needed. + 2013-10-09 Glenn Morris * eval.c (Fcond): Doc tweak. diff --git a/src/lisp.h b/src/lisp.h index 3773398d773..6638cc66e9f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -31,7 +31,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include INLINE_HEADER_BEGIN @@ -115,11 +114,9 @@ typedef EMACS_UINT uprintmax_t; /* Extra internal type checking? */ /* Define an Emacs version of 'assert (COND)'. COND should be free of - side effects; it may be evaluated zero or more times. If COND is false, - Emacs reliably crashes if ENABLE_CHECKING is defined and behavior - is undefined if not. The compiler may assume COND while optimizing. */ + side effects; it may be evaluated zero or more times. */ #ifndef ENABLE_CHECKING -# define eassert(cond) assume (cond) +# define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles. */ #else /* ENABLE_CHECKING */ extern _Noreturn void die (const char *, const char *, int); @@ -136,7 +133,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE; # define eassert(cond) \ (suppress_checking || (cond) \ - ? assume (cond) \ + ? (void) 0 \ : die (# cond, __FILE__, __LINE__)) #endif /* ENABLE_CHECKING */ -- 2.30.2